﻿<%@ WebHandler Language="C#" Class="CategoryNews_UpdateStatus" %>

using System;
using System.Web;
using HNG.Portal.BLL;
using HNG.Portal.DAL;
using HNG.Portal.DAL.EntityClasses;
using HNG.Portal.DAL.FactoryClasses;
using HNG.Portal.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

public class CategoryNews_UpdateStatus : IHttpHandler
{
    TblDanhMucTinManager _TblDanhMucTinManager = new TblDanhMucTinManager();
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/html";
        string check = "";
        int CateID = 0;
        string Type = "";
        try{CateID = Convert.ToInt32(context.Request.QueryString["id"].Trim());}
        catch{CateID = 0;}
        try { Type = context.Request.QueryString["t"].Trim(); }
        catch { Type = ""; }
        if (CateID != 0)
        {

            TblDanhMucTinEntity _TblDanhMucTinEntity = _TblDanhMucTinManager.SelectOne(CateID);
            _TblDanhMucTinEntity.TrangThai = !_TblDanhMucTinEntity.TrangThai;
            _TblDanhMucTinEntity.Type = Type;
            check = _TblDanhMucTinEntity.TrangThai.ToString();
            
            try { _TblDanhMucTinManager.Update(_TblDanhMucTinEntity).ToString(); check = _TblDanhMucTinEntity.TrangThai.ToString().ToLower(); }
            catch { }
        }
        context.Response.Write(check);
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}